﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace SQLDeployAnything.Data.Deployment
{
    public abstract class Task : INotifyPropertyChanged
    {
        private Step mDeployStep;
        private string mName;
        private string mConnectionName;

        protected internal Step DeploymentStep { get { return mDeployStep; } }

        public string TaskName 
        { 
            get { return mName; }
            set 
            { 
                mName = value;
                OnPropertyChanged("TaskName");
            }
        }

        public string Connection 
        { 
            get { return mConnectionName; }
            set
            {
                mConnectionName = value;
                OnPropertyChanged("Connection");
            }
        }

        public abstract void ExecuteTask();

        protected abstract bool Validate();

        public event PropertyChangedEventHandler PropertyChanged;

        protected internal void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(name));
        }
    }
}
